%\RequirePackage{microtype}
%\RequirePackage{mparhack} % marginpar 有时给出的位置不对，这是个修正
\RequirePackage{microtype,ifthen,ifplatform,minted}

%%%% 字体设置
\RequirePackage{fontspec,xunicode,xltxtra,xeCJK}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\setmainfont{NewComputerModern10}
%\setmainfont{XITS}
%\setsansfont{Merriweather Sans Light}[BoldFont={Merriweather Sans},Numbers=Lowercase]
\setsansfont[BoldFont=Myriad Pro]{Myriad Pro Light}
\setmonofont[Scale=0.9]{DejaVu Sans Mono}
\setCJKmainfont[
    BoldFont=FZYaSong-DB-GBK,
    ItalicFont=STKaiti,
]{FZShuSong-Z01S}
\setCJKsansfont[BoldFont=Noto Sans CJK SC, ItalicFont=STKaiti]{Noto Sans CJK SC Light}
\setCJKmonofont[Scale=0.9]{FZZhunYuan-M02}
\newcommand\songti{\CJKfontspec{FZShuSong-Z01S}}
\newcommand\heiti{\CJKfontspec{SimHei}}
\newcommand\xinwei{\CJKfontspec{STXinwei}}
\newcommand\fangsong{\CJKfontspec{STFangsong}}
\newcommand\kaiti{\CJKfontspec{STKaiti}}
\newcommand\lishu{\CJKfontspec{STLiti}}
\newcommand\xingkai{\CJKfontspec{STXingkai}}


% 数学设定
\RequirePackage{amsmath,amsthm,unicode-math,mathtools,stmaryrd,multicol,xcolor,extarrows,verbatim,minted}
\unimathsetup{math-style=TeX}
\setmathfont{NewComputerModernMath}
\setmathfont[range=cal]{NewComputerModernMath}
%\setmathfont{XITS Math}
%\setmathfont{XITS Math}[range=cal]
\setmathfont[range=scr]{XITS Math}

\setlength\multicolsep{\topsep}
\RequirePackage{array}   % for \newcolumntype macro
\newcolumntype{L}{>{$}l<{$}} % math-mode version of "l" column type
\newcolumntype{R}{>{$}r<{$}} 
\newcolumntype{C}{>{$}c<{$}} 



% 章节格式
\newlength{\secspacingafter}
\setlength{\secspacingafter}{.5em}
%\RequirePackage[compact]{titlesec}
%\titlespacing*{\section}
%{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\RequirePackage{titlesec}
% 练习中也有设置 section
\titleformat{\section}{\centering\bfseries\sffamily}{\thesection}{\secspacingafter}{\parnotereset}
\titleformat{\subsection}{\bfseries\sffamily}{\thesubsection}{\secspacingafter}{}
\titleformat{\paragraph}[runin]{\bfseries\sffamily}{\theparagraph}{\secspacingafter}{}

%%% 放到小节标题后的注记
\def\ignorespacesandallpars{%
  \@ifnextchar\par
    {\expandafter\ignorespacesandallpars\@gobble}%
    {}%
}
\newcommand\hint{\par\noindent {\lishu 提示}：\ignorespacesandallpars}



\numberwithin{equation}{section}
%%%%theorem style
\newtheoremstyle{plainzh}% name
{.5em}% Space above
{.5em}% Space below 
{\kaiti}% Body font
{}% Indent amount
{\bfseries}% Theorem head font
{.}% Punctuation after theorem head 
{.5em}% Space after theorem head 
{}% Theorem head spec (can be left empty, meaning ‘normal’ )
\newtheoremstyle{definitionzh}{.5em}{.5em}{}{}{\bfseries}{.}{.5em}{}
\theoremstyle{plainzh}
\newtheorem*{theorem*}{定理}
\newtheorem{theorem}{定理}
\newtheorem{observation}[theorem]{观察}
\newtheorem{promise}[theorem]{承诺}
\newtheorem{proposition}[theorem]{命题}
\newtheorem*{proposition*}{命题}
\newtheorem{problem}[theorem]{难题}
\newtheorem{question}[theorem]{问题}
\newtheorem{conjecture}[theorem]{猜想}
\newtheorem{corollary}[theorem]{推论}
\newtheorem*{corollary*}{推论}
\newtheorem{assertion}[theorem]{论断}
\newtheorem{lemma}[theorem]{引理}
\newtheorem*{lemma*}{引理}
\newtheorem*{claim}{断言}
\theoremstyle{definitionzh}
\newtheorem{definition}[theorem]{定义}
\newtheorem*{notation}{记号}
\newtheorem{example}[theorem]{例}
\newtheorem*{note*}{注}
\renewcommand\proofname{证明}
\newenvironment{solution}{
    \renewcommand\proofname{解答}\begin{proof}
}{\end{proof}\renewcommand\proofname{证明}}
\newtheorem{exercise}{}
\counterwithin*{exercise}{section}
\newtheoremstyle{exercise*}{3pt}{3pt}{}{}{\bfseries}{.}{.5em}{#3}
\theoremstyle{exercise*}
\newtheorem*{exercise*}{}

\newtheorem{addendum}{}[exercise]
\theoremstyle{definitionzh}
\newtheorem{remark}{注记}[exercise]
\newtheorem*{remark*}{注记}
\RequirePackage{titling}

% utf 符号
\RequirePackage{utfsym, marginnote,chemformula}

\RequirePackage{titlesec}
\titleformat{\section}{\center\normalsize\bfseries\sffamily}{习题 \thesection}{.5em}{}
% 目录与章节的排版
\renewcommand{\contentsname}{目录}
\renewcommand\appendixname{附录}

\RequirePackage[
  backend=biber,
  hyperref=true,
  doi=true,
  %style=gb7714-2015,
  %gbnamefmt=lowercase
]{biblatex}



% 给习题打星号: https://tex.stackexchange.com/questions/123392/add-a-marker-to-the-left-of-the-text
\newcommand{\starmark}{\strut\vadjust{\domark}}
\newcommand{\domark}{%
  \vbox to 0pt{
    \kern-\dp\strutbox
    \hbox{\smash{\llap{*\kern.1em}}}
    \vss
  }%
}

\RequirePackage[export]{adjustbox}
\graphicspath{ {../images}}

\setlength{\parindent}{2em}

%%%% 列表
\RequirePackage[shortlabels]{enumitem}
\setlist{parsep=0em,itemsep=3pt,partopsep=0em,topsep=1ex}
\setlist[enumerate,1]{
    listparindent=0em,
    label=\textup{(\arabic*)},
    labelindent=0em,
    itemindent=0em,
    widest,
    align=parleft,
    leftmargin=2em,
    labelsep=*,
}
\setlist[enumerate,2]{
    listparindent=0em,
    label=\textup{(\roman*)},
    labelindent=0em,
    itemindent=0em,
    widest,
    align=parleft,
    leftmargin=2em,
    labelsep=*,
}

%%%% 图片
\RequirePackage{graphicx,tikz,pgfplots,subcaption}
\renewcommand{\figurename}{图}
\usetikzlibrary{
  cd,arrows.meta,calc,matrix,
  petri,positioning,decorations,
  decorations.pathreplacing,pgfplots.fillbetween,
  decorations.markings,intersections,
  calligraphy,shapes.geometric,
}
\tikzset{>=Computer Modern Rightarrow}

\RequirePackage{hyperref}
\hypersetup{	
    bookmarks=true,
    unicode=true,
    psdextra,
    colorlinks=true,
    pdfborder={0,0,0},
}

\RequirePackage{zhnumber}
\newcommand{\fangfa}[2][方法]{{\bfseries #1\zhnumber{#2}}：}

\input{symbols.sty}
\RequirePackage{datetime}
\newdateformat{mydate}{\THEYEAR 年 \THEMONTH 月 \THEDAY 日}
\author{sc@hsu.edu.cn}
\date{\mydate\today}


